import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.Month;

public class Test {


    //获取此时时间
    public static void main1(String[] args) {
        LocalDateTime localdatetime = LocalDateTime.now();

        System.out.println(localdatetime);

    }


    public static void main2(String[] args) {

        LocalDateTime localdatetime = LocalDateTime.now();

        int year = localdatetime.getYear();
        System.out.println("year = " + year);

        Month month = localdatetime.getMonth();
        //System.out.println("month = " + month);//英文显示
        System.out.println("month = " + month.getValue());//中文显示

        int date = localdatetime.getDayOfMonth();
        System.out.println("date = " + date);

        int hour = localdatetime.getHour();
        System.out.println("hour = " + hour);

        int min = localdatetime.getMinute();
        System.out.println("min = " + min);

        int sec = localdatetime.getSecond();
        System.out.println("second = " + sec);
    }


    public static void main3(String[] args) {
        LocalDateTime localdatetime = LocalDateTime.now();
        System.out.println("此时时间为：" + localdatetime);
        System.out.println("今天是周：" + localdatetime.getDayOfWeek().getValue());
        System.out.println("这个月第几天：" + localdatetime.getDayOfMonth());
        System.out.println("这是今年第几天：" + localdatetime.getDayOfYear());
    }



    //BigDecimal
    public static void main4(String[] args) {
        BigDecimal d = new BigDecimal(1.99);
        System.out.println(d);//精度会不准确

        BigDecimal s = new BigDecimal("1.99");
        System.out.println(s);
    }


    //BigDecimal加减乘除
    public static void main(String[] args) {
        BigDecimal num1 = new BigDecimal("120");
        BigDecimal num2 = new BigDecimal("10");

        BigDecimal add = num1.add(num2);
        System.out.println("相加->" + add);

        BigDecimal sub = num1.subtract(num2);
        System.out.println("相减->" + sub);

        BigDecimal mul = num1.multiply(num2);
        System.out.println("相乘->" + mul);

        BigDecimal divide = num1.divide(num2);
        System.out.println("相除->" + divide);

    }





    //LoaclDateTime和LoaclDate区别？？？



}





















